package laplacianGrowthUtils;

public class Grid3DPotential {
	protected int x,y,z; 
	protected double potential;
	public double getPotential() {
		return potential;
	}
	public void setPotential(double potential) {
		this.potential = potential;
	}
	public int getX() {
		return x;
	}
	public int getY() {
		return y;
	}
	public int getZ() {
		return z;
	}
	
	public Grid3DPotential(int x, int y,int z, double potential) {
		super();
		this.x = x;
		this.y = y;
		this.z=z; 
		this.potential = potential;
	}
	public Grid3DPotential(int x, int y,int z) {
		super();
		this.x = x;
		this.y = y;
		this.z=z; 
	} 
	
	public int hashCode(){
		return (x+y+z)%23; 
	}
	public boolean equals(Object o){
		if(!(o instanceof Grid3DPotential)) return false; 
		Grid3DPotential go=(Grid3DPotential)o; 
		return ((x==go.x)&&(y==go.y)&&(z==go.z)); 
	}
		
	public static double distance(Grid3DPotential a,Grid3DPotential b){
		return Math.sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z)); 
	}
	public String toString(){
		String s="("+x+","+y+","+z+" "+potential+")";
		return s; 
	}
}
